<template>
    <el-row>
        <el-row>
            <el-col class="title box box-pack-between">
                <div class="btn">
                    <el-input class="reset-input" placeholder="搜索" v-model="searchText" @input="getData()">
                        <i slot="suffix" class="el-input__icon el-icon-search cp" @click="getData()"></i>
                    </el-input>
                </div>
            </el-col>
        </el-row>

        <el-row class="mt20">
            <el-col>
                <el-table :data="page.list" stripe style="width: 1301px" :header-cell-style="{background:'#F0F1F8', color:'#2F3142'}" border>
                    <el-table-column type="index" label="序号" width="200" align="center"></el-table-column>
                    <el-table-column prop="name" label="姓名" align="center" width="300"></el-table-column>
                    <!-- <el-table-column prop="roleName" label="角色" width="120" align="center"></el-table-column> -->
                    <el-table-column prop="mobile" label="手机号" width="400" align="center"></el-table-column>
                    <el-table-column prop="zgh" label="职工号" width="400" align="center"></el-table-column>
                </el-table>
            <el-pagination style="margin: 50px;" @current-change="getData" background layout="prev, pager, next" :total="page.total"
                :current-page="page.pageNum" :page-size="page.pageSize" hide-on-single-page></el-pagination>
            </el-col>
        </el-row>
    </el-row>
</template>

<script>
    export default {
        data() {
            return {
                page: {
                    total: 0,
                    pageSize: 10,
                    pageNum: 1,
                    list: []
                },
                loginInfo: this.$store.state.loginInfo,
                tkzt: false,
                searchText: '',
                title:'添加'
            };
        },
        mounted() {
            this.getData();
        },
        methods: {
            tableRowClassName({
                row,
                rowIndex
            }) {
                if (rowIndex === 1) {
                    return 'warning-row';
                } else if (rowIndex === 3) {
                    return 'success-row';
                }
                return '';
            },
            closeTk() {
                this.tkzt = false;
            },
            openPopup() {
                this.tkzt = true
            },
            getData(pageNum) {
                var params = {
                    schoolid: this.loginInfo.user.schoolId,
                    searchtext:this.searchText,
                    pageNum:pageNum
                };
                this.$api.Admin.getTrData(params).then(res => {
                    if (res.code == '0') {
                        this.page = res.list;
                    } else {
                        this.$message.error('请求失败！');
                    }
                })
            },
            changeStatus(userid, status) {
                var params = {
                    'userId': userid,
                    'status': status
                };
                this.$api.szhgl.qyjy(params).then(res => {
                    if (res.code == '0') {
                        this.$message.success('操作成功！');
                        this.getData();
                    } else {
                        this.$message.error('请求失败！');
                    }
                })
            },
            handleSelect() {

            },
            clickAdd() {

            }
        }
    }
</script>

<style>
    .el-table .warning-row {
        background: oldlace;
    }

    .el-table .success-row {
        background: #f0f9eb;
    }
</style>
